package cn.hanyx.coder.design.paradigm.lod.demo01;

/**
 * HtmlDownloader 类用来通过 URL 获取网页
 */
public class HtmlDownloader {
    private NetworkTransporter transporter;//通过构造函数或IOC注入

    public Html downloadHtml(String url) {
        HtmlRequest htmlRequest = new HtmlRequest(url);

        Byte[] rawHtml = transporter.send(htmlRequest.getUrl(), htmlRequest.getContent().getBytes());
        return new Html(rawHtml);
    }
}